package com._CPA_.dao;

import com._CPA_.pojo.UserInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;




@Repository
@org.apache.ibatis.annotations.Mapper
public interface UserMapper extends Mapper<UserInfo>{
    @Select("select user_name from user_info where user_name = #{name}")
    public String selectUserName(String name);

    // 查询手机号是否相同
    @Select("select phone from user_info where phone = #{My_phone}")
    public String selectPhone(String My_phone);

    @Select("select password from user_info where user_id = #{id}")
    public String selectPassWord(String id);


    // 根据Id查询某个人的全部信息
    @Select("select * from user_info where user_id = #{id}")
    public UserInfo selectUserAll(String id);


    // 用户删除功能  根据用户生成的ID
    @Delete("delete from user_info where user_name = #{name}")
    public void isDelete(String name);

    //  用户修改功能  根据对象来进行修改每个信息
    @Update("update cpa_db.user_info set user_name = #{user_name},gender = #{gender},phone = #{phone},nick_name = #{nick_name} where user_name = #{user_name}")
    public void isUpdate(UserInfo userInfo);

    // 根据用户ID来进行修改密码
    @Update("update cpa_db.user_info set password = #{password} where user_id = #{user_id}")
    public void isPassWordUpdate(UserInfo userInfo);

}
